<%--
  Created by IntelliJ IDEA.
  User: dailyblue
  Date: 2023/4/2
  Time: 09:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>session对象</title>
</head>
<body>
<h3>session对象</h3>
<%
    String id = session.getId();
    boolean isNew = session.isNew();
    // session.invalidate(); // 让会话失效
    long creationTime = session.getCreationTime();
    long lastAccessedTime = session.getLastAccessedTime();
    long maxInactiveInterval = session.getMaxInactiveInterval();
    session.setMaxInactiveInterval(20); // 单位：秒
    out.print("会话ID：" + id + "<br/>");
    out.print("是否是新会话：" + isNew + "<br/>");
    out.print("创建时间：" + creationTime + "<br/>");
    out.print("最后一次请求时间：" + lastAccessedTime + "<br/>");
    out.print("最大存活时间：" + maxInactiveInterval + "<br/>");
%>
</body>
</html>
